package com.huluobo.a2205kotlinjetpackdemo.lifecycle

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

/**
 *  Created by LC on 2024/9/12.
 */
class ADViewModel : ViewModel() {
    var timing: Long = 15000L

    //声明了一个LiveData来保存时间的值
    val timingResult = MutableLiveData<Long>()

    fun setTimeIngResult(timing: Long) {
        //每当调用带该方法时,将传入的long给时间的LiveData赋值
        //setValue运行在主线程当中
        timingResult.value = timing
        //运行在子线程当中
//        timingResult.postValue(timing)
    }
}